package com.xbongbong.pro.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

/**
 * @author 吴峰
 * @version v1.0
 * @date 2019/4/2 15:01
 * @since v1.0
 */
@Getter
public enum SummaryTypeEnum {

    /**
     * 汇总类型
     */
    NONE(0, "enum.summaryType.memo.none"),
    SUM(1, "enum.summaryType.memo.sum"),
    AVERAGE(2, "enum.summaryType.memo.average"),
    ;

    private Integer type;

    private String memo;

    SummaryTypeEnum(Integer type, String memo) {
        this.type = type;
        this.memo = memo;
    }

    /**
     * 获取描述
     * @param type
     * @return java.lang.String
     * @author zcp
     * @date 2019/6/30 22:17
     * @since v1.0
     * @version v1.0
     */
    public static String getSummaryTypeMemo(Integer type){
        for (SummaryTypeEnum cache: values()){
            if(cache.getType().equals(type)){
                return cache.getMemo();
            }
        }
        return null;
    }

    public String getMemo() {
        return I18nMessageUtil.getMessage(memo);
    }
}
